getApp();

var t = require("../../../../utils/qqmap-wx-jssdk.min.js"), a = require("../../../../utils/point.js"), e = new t({
    key: "7A6BZ-DAZW6-ELWSU-ENCGS-NJAYS-X5FVC"
});

Page({
    data: {
        contHeight: 940,
        bottomHeight: 552,
        curr: 1,
        point: {},
        lat: "",
        lng: "",
        name: "",
        address: "",
        share: 0,
        zhengfuList: [],
        yinhangList: [],
        shangyeList: [],
        gongyuanList: [],
        markers: [],
        mapshow: !1
    },
    onLoad: function(t) {
        var n = this;
        "topmap" == t.source ? n.setData({
            mapshow: !1
        }) : n.setData({
            mapshow: !0
        }), n.setData({
            share: t.share ? t.share : 0,
            curr: t.curr
        });
        var i = wx.createSelectorQuery();
        i.select("#map_area").boundingClientRect(), i.exec(function(t) {
            n.setData({
                contHeight: t[0].height
            });
        });
        var o = wx.createSelectorQuery();
        o.select("#map_text").boundingClientRect(), o.exec(function(t) {
            n.setData({
                bottomHeight: t[0].height
            });
        }), n.setData({
            name: t.name,
            address: t.address,
            lat: t.lat,
            lng: t.lng
        }), a.getPoint({
            lat: 31.126358,
            lng: 121.506724
        }).then(function(t) {
            n.setData({
                point: t,
                markers: [ {
                    id: 100001,
                    latitude: t.lat,
                    longitude: t.lng,
                    zIndex: 3,
                    callout: {
                        content: " 东方懿德城",
                        padding: 10,
                        display: "ALWAYS",
                        textAlign: "center",
                        borderRadius: 5,
                        bgColor: "#f4102a",
                        fontSize: 12,
                        color: "#fff"
                    }
                } ]
            });
            var a = [ {
                id: 100001,
                latitude: 31.126358,
                longitude: 121.506724,
                zIndex: 3,
                callout: {
                    content: " 东方懿德城",
                    padding: 10,
                    display: "ALWAYS",
                    textAlign: "center",
                    borderRadius: 5,
                    bgColor: "#f4102a",
                    fontSize: 12,
                    color: "#fff"
                }
            } ];
            e.search({
                keyword: "政府",
                location: {
                    latitude: 31.126358,
                    longitude: 121.506724
                },
                distance: "1000",
                page_size: 20,
                success: function(t) {
                    for (var e = t.data, i = 0; i < e.length; i++) {
                        var o = e[i], s = {
                            id: i,
                            width: 10,
                            height: 10,
                            iconPath: "../../../../images/zhuanti/bolong/marker.png",
                            latitude: o.location.lat,
                            longitude: o.location.lng,
                            callout: {
                                content: i + 1,
                                display: "ALWAYS",
                                fontSize: 12,
                                color: "#ff9900"
                            }
                        };
                        a.push(s);
                    }
                    n.setData({
                        markers: a,
                        zhengfuList: t.data,
                        yinhangList: t.data,
                        shangyeList: t.data,
                        gongyuanList: t.data
                    });
                },
                fail: function(t) {}
            });
        });
    },
    searchThat: function(t) {
        var a = t.currentTarget, n = this;
        n.setData({
            curr: Number(a.dataset.id)
        });
        n.data.point;
        var i = [ {
            id: 100001,
            latitude: 31.126358,
            longitude: 121.506724,
            zIndex: 3,
            callout: {
                content: " 东方懿德城",
                padding: 10,
                display: "ALWAYS",
                textAlign: "center",
                borderRadius: 5,
                bgColor: "#f4102a",
                fontSize: 12,
                color: "#fff"
            }
        } ];
        e.search({
            keyword: a.dataset.search,
            location: {
                latitude: 31.126358,
                longitude: 121.506724
            },
            distance: "1000",
            page_size: 20,
            success: function(t) {
                for (var a = t.data, e = 0; e < a.length; e++) {
                    var o = a[e], s = {
                        id: e,
                        width: 10,
                        height: 10,
                        iconPath: "../../../../images/zhuanti/bolong/marker.png",
                        latitude: o.location.lat,
                        longitude: o.location.lng,
                        callout: {
                            content: e + 1,
                            display: "ALWAYS",
                            fontSize: 12,
                            color: "#ff9900"
                        }
                    };
                    i.push(s);
                }
                n.setData({
                    markers: i,
                    zhengfuList: t.data,
                    yinhangList: t.data,
                    shangyeList: t.data,
                    gongyuanList: t.data
                });
            },
            fail: function(t) {}
        });
    },
    goMap: function(t) {
        wx.getLocation({
            type: "gcj02",
            success: function(t) {
                wx.openLocation({
                    latitude: 31.126358,
                    longitude: 121.506724,
                    address: "浦东新区浦东懿行路603弄",
                    name: "东方懿德城",
                    scale: 18
                });
            }
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function(t) {
        return {
            title: "东方懿德城",
            path: "pages/index/biguiyuan",
            imageUrl: "https://fang-oss.haozu.com/static/image/picture/biguiyuan/bird-view.jpg",
            success: function(t) {
                wx.showToast({
                    title: "转发成功",
                    duration: 2e3,
                    icon: "none"
                });
            },
            fail: function(t) {},
            complete: function(t) {}
        };
    }
});